package com.bestdreamer.design.principle.dependenceinversion;

public class Course {

    /*
    // version 1.0
    public void studyJavaCourse(){
        System.out.println("我在学习 Java 课程");
    }
    public void studyFECourse(){
        System.out.println("我在学习前端课程");
    }
    public void studyPythonCourse(){
        System.out.println("我在学习 Python 课程");
    }
    */

    // version 2.0
    public void studyImoocCourse(ICourse iCourse){
        iCourse.studyCourse();
    }


    /*
    // version 3.0
    private ICourse iCourse;

    public Course(ICourse iCourse){
        this.iCourse = iCourse;
    }

    public void studyImoocCourse(){
        iCourse.studyCourse();
    }
     */

    // version 4.0
    private ICourse iCourse;

    public void setiCourse(ICourse iCourse) {
        this.iCourse = iCourse;
    }

    public void studyImoocCourse(){
        iCourse.studyCourse();
    }
}
